package com.servilet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

/**
 * 韩要雷
 */
@WebServlet("/s01")
public class servlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=UTF-8");
        PrintWriter out = resp.getWriter();

        //1.模拟数据库查询，展现所有的门店信息
        ArrayList<String> list = new ArrayList<>();
        list.add("01,狗不理包子，0001-88886666");
        list.add("02,全聚德烤鸭，0031-88886688");
        list.add("03,海&nbsp&nbsp底&nbsp&nbsp捞，0041-66888666");
        list.add("04,楼  外 楼，0021-66888666");
        list.add("05,凯     瑞，0011-66888666");

        //2.将数据存入域对象中
        req.setAttribute("list",list);

        //3.用请求转发 door_list.jsp中，取出里面的所有数据
        req.getRequestDispatcher("door_list.jsp").forward(req,resp);
    }
}
